
module.exports = {
  async fetch({ args }) {
    
       url = `http://www.zxcs.info/index.php?keyword=${encodeURI(args.keyword)}`

    
    
    let resp = await $http.get(url)
    let html = resp.data
    const $ = cheerio.load(html)
    let list = $('#plist')
    let items = []
    list.each((index, li) => {
      let title = $('a','dt',li).text()
      let url = $('a','dt',li).attr('href')
      let id =(url||'1234').match(/\d+/)
      items.push({
        link: url,
        style: 'list',
        title: title,
       summary: $('a' ,'dd',li).text().replace('查看全文',''),
        route: $route('download', {
        url: 'http://www.zxcs.info/download.php?id='+id
        })
      })
    })
    return {
    title:decodeURI(args.keyword) + '🉐搜索结果',
      items: items
    }
  }
}
